home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Prg / KALENDAR.ZIP / TEST5.FRM < prev   
Text File  |  1997-09-14  |  6KB  |  194 lines

  1. VERSION 2.00
  2. Begin Form Form5 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Schedule Kalendar"
  6.    ClientHeight    =   4230
  7.    ClientLeft      =   3225
  8.    ClientTop       =   630
  9.    ClientWidth     =   6030
  10.    ForeColor       =   &H00000000&
  11.    Height          =   4920
  12.    Left            =   3165
  13.    LinkTopic       =   "Form5"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   4230
  17.    ScaleWidth      =   6030
  18.    Top             =   0
  19.    Width           =   6150
  20.    Begin Kalendar Kalendar1 
  21.       ArrowDelay      =   500
  22.       BackColor       =   &H00FFFFFF&
  23.       CalendarFormat  =   0  'Month
  24.       ChgOnOtherMon   =   -1  'True
  25.       DateDispStyle   =   2  'User
  26.       DayAlignment    =   0  'Upper Left
  27.       DOWAlign        =   2  'Center
  28.       DOWBackColor    =   &H00008000&
  29.       DOWBorder       =   -1  'True
  30.       DOWDispStyle    =   2  'Medium
  31.       DOWFontBold     =   -1  'True
  32.       DOWFontItalic   =   0   'False
  33.       DOWFontName     =   "Arial"
  34.       DOWFontSize     =   10
  35.       DOWFontStrikeThru=   0   'False
  36.       DOWFontUnderline=   0   'False
  37.       DOWForeColor    =   &H00FFFFFF&
  38.       EnableKeys      =   -1  'True
  39.       FirstDOW        =   0  'Sunday
  40.       FixedDayHeight  =   0   'False
  41.       FontBold        =   -1  'True
  42.       FontItalic      =   -1  'True
  43.       FontName        =   "Arial"
  44.       FontSize        =   12
  45.       FontStrikethru  =   0   'False
  46.       FontUnderline   =   0   'False
  47.       ForeColor       =   &H00000000&
  48.       Height          =   4230
  49.       Language        =   0  'English
  50.       Left            =   30
  51.       LineColor       =   &H00000000&
  52.       MonAlign        =   2  'Center
  53.       MonBackColor    =   &H00FFFFFF&
  54.       MonDispStyle    =   2  'Month/Year
  55.       MonFontBold     =   0   'False
  56.       MonFontItalic   =   0   'False
  57.       MonFontName     =   "Times New Roman"
  58.       MonFontSize     =   14
  59.       MonFontStrikeThru=   0   'False
  60.       MonFontUnderline=   0   'False
  61.       MonForeColor    =   &H00000000&
  62.       OtherMonBackColor=   &H00FFFFFF&
  63.       OtherMonForeColor=   &H00C0C0C0&
  64.       SelDayBackColor =   &H00FF00FF&
  65.       SelDayForeColor =   &H0000FFFF&
  66.       ShowAllDays     =   -1  'True
  67.       ShowArrows      =   -1  'True
  68.       ShowLines       =   -1  'True
  69.       ShowSelection   =   -1  'True
  70.       TabIndex        =   0
  71.       Text            =   "07/02/94"
  72.       TextFormat      =   0  'mdy
  73.       Top             =   0
  74.       Width           =   6000
  75.    End
  76.    Begin Menu mnuFile 
  77.       Caption         =   "&File"
  78.       Begin Menu mnuFPrint 
  79.          Caption         =   "Print &Portrait"
  80.       End
  81.       Begin Menu mnuFPrintLand 
  82.          Caption         =   "Print &Landscape"
  83.       End
  84.       Begin Menu mnuFPrint3by3 
  85.          Caption         =   "Print 3"" X 3"""
  86.       End
  87.    End
  88. End
  89. Option Explicit
  90.  
  91. Sub Form_Activate ()
  92.     SetDescription Sample5Description()
  93. End Sub
  94.  
  95. Sub Form_Load ()
  96.     Kalendar1.Text = Date
  97. End Sub
  98.  
  99. Sub Form_Resize ()
  100.     Kalendar1.Move 0, 0, Form5.ScaleWidth, Form5.ScaleHeight
  101. End Sub
  102.  
  103. Sub Kalendar1_ClickDay ()
  104. Dim info As DateRange
  105.     If GetDateRangeInfo((Kalendar1.Julian), info) Then
  106.         Form5.Caption = info.Description
  107.     Else
  108.         Form5.Caption = ""
  109.     End If
  110.  
  111. End Sub
  112.  
  113. Sub Kalendar1_DrawOnDay (hDC As Integer, State As Integer, theDay As Long, x As Single, y As Single, x2 As Single, y2 As Single)
  114. Dim info As DateRange
  115. Dim r As Rect
  116. Dim retval As Variant
  117. Dim oldHBrush As Integer, hBrush As Integer, oldPen As Integer
  118.  
  119.     If GetDateRangeInfo(theDay, info) Then
  120.  
  121.         KalWindowAPIRect x, y, x2, y2, r
  122.  
  123.         If info.StartDate = theDay Then
  124.             r.left = r.left + 20
  125.         End If
  126.         If info.EndDate = theDay Then
  127.             r.right = r.right - 20
  128.         End If
  129.  
  130.         hBrush = CreateSolidBrush(info.color)
  131.         oldHBrush = SelectObject(hDC, hBrush)
  132.         oldPen = SelectObject(hDC, GetStockObject(NULL_PEN))
  133.         
  134.         r.top = r.bottom - 8
  135.         r.bottom = r.bottom - 2
  136.  
  137.         retval = Rectangle(hDC, r.left, r.top, r.right, r.bottom)
  138.  
  139.         retval = SelectObject(hDC, oldPen)
  140.         retval = SelectObject(hDC, oldHBrush)
  141.         retval = DeleteObject(hBrush)
  142.     End If
  143. End Sub
  144.  
  145. Sub mnuFPrint_Click ()
  146.     Kalendar1.PrintAction = KAL_PRINT_PORTRAIT
  147. End Sub
  148.  
  149. Sub mnuFPrint3by3_Click ()
  150. Dim SaveMonFontSize As Single
  151. Dim saveBackColor As Long
  152.  
  153.     Screen.MousePointer = 11
  154.     SaveMonFontSize = Kalendar1.MonFontSize
  155.     saveBackColor = Kalendar1.MonBackColor
  156.  
  157.     Kalendar1.MonFontSize = 14
  158.     Kalendar1.MonFontBold = True
  159.     Kalendar1.BorderStyle = 1
  160.     Kalendar1.MonBackColor = RGB(255, 255, 255)
  161.  
  162.     Kalendar1.PrintX = 2880
  163.     Kalendar1.PrintY = 2880
  164.     Kalendar1.PrintWidth = 1440 * 3
  165.     Kalendar1.PrintHeight = 1440 * 3
  166.     Kalendar1.PrintHDC = Printer.hDC
  167.  
  168.     Printer.Print   ' Necessary for VB to send STARTDOC, before printing the Kalendar.
  169.     Kalendar1.PrintAction = KAL_PRINT_USER
  170.  
  171.     Kalendar1.MonFontBold = False
  172.     Kalendar1.MonFontSize = SaveMonFontSize
  173.     Kalendar1.MonBackColor = saveBackColor
  174.     Kalendar1.BorderStyle = 0
  175.  
  176.     Printer.EndDoc
  177.  
  178.     Screen.MousePointer = 0
  179. End Sub
  180.  
  181. Sub mnuFPrintLand_Click ()
  182.     Kalendar1.PrintAction = KAL_PRINT_LANDSCAPE
  183. End Sub
  184.  
  185. Function Sample5Description () As String
  186. Dim s As String
  187.  
  188.     s = "One more example of the DrawOnDay event." & CR
  189.     s = s & "You can also print this Kalendar using the three different methods available."
  190.  
  191.     Sample5Description = s
  192. End Function
  193.  
  194.